package bsh.dyn;

import bsh.CompiledScript;

/**
 * Invocable that contains a group of Invocables, each associated with a unique callsite id. Callsites that share an id but differs on some
 * class type should not be colapsed together
 * 
 * @author takeshi
 */
public interface ColapsedInvocable {

    /**
     * Invokes the method / constructor
     * 
     * @param callsiteId int
     * @param script the {@link CompiledScript}
     * @param target the method target. May be <code>null</code> if the method is static or is a constructor
     * @param parameters the parameters to be passed. Should almost never be null
     * @return the return value if any
     * @throws Throwable the throwable
     */
    Object invoke(int callsiteId, CompiledScript script, Object target, Object[] parameters) throws Throwable;

}
